import { useContext } from "react";
import RootContext from "../context/rootContext";

const Counter = () => {
    const { count, setCount } = useContext(RootContext);
    return (
        <>
            <div className='alert alert-danger'>当前数值为：{count}</div>
            <button
                className='btn btn-block btn-primary'
                onClick={() => setCount(count + 3)}
            >
                增加
            </button>
        </>
    );
};

export default Counter;
